package njust.cms.sql;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

public class Hql {
	
	private SessionFactory sessionFactory;

	public static List findByhql(String queryString) {
		try {
			Query queryObject = HibernateSessionFactory.getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {
			throw re;
		}
	}
	public static Session getSession() {
		try {
			
			return HibernateSessionFactory.getSession();
		} catch (RuntimeException re) {
			throw re;
		}
	}
	public static SessionFactory SessionFactory() {
		try {
			
			return HibernateSessionFactory.getSessionFactory();
		} catch (RuntimeException re) {
			throw re;
		}
	}

}
